from django.db import models
from django.utils import timezone


class AbstractBaseModel(models.Model):
    """Abstract model that inherits the Django model and automatically adds 'created' and 'modified' fields."""
    created = models.DateTimeField(auto_now_add=True, db_index=True)
    modified = models.DateTimeField(auto_now=True, db_index=True)

    class Meta:
        abstract = True  # it doesn't automatically map to a database table


class User(AbstractBaseModel):
    first_name = models.CharField(max_length=50)
    last_name = models.CharField(max_length=50)
    email = models.EmailField()


class UserActivity(AbstractBaseModel):
    user = models.ForeignKey(User)
    activity_type = models.CharField(max_length=100)
    description = models.TextField(max_length=500)